/*
 *  This file is part of the SIRIUS libraries for analyzing MS and MS/MS data
 *
 *  Copyright (C) 2024 Bright Giant GmbH
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along with SIRIUS.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 *  https://openapi-generator.tech
 *  Do not edit the class manually.
 */


package io.sirius.ms.sdk.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.sirius.ms.sdk.model.BasicSpectrum;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * The MsData wraps all spectral input data belonging to a (aligned) feature. All spectra fields are optional.  However, at least one Spectrum field needs to be set to create a valid MsData Object.  The different types of spectra fields can be extended to adapt to other MassSpec measurement techniques not covered yet.  &lt;p&gt;  Each Feature can have:  - One extracted isotope pattern (optional)  - One merged MS/MS spectrum (optional)  - One merged MS spectrum (optional)  - many MS/MS spectra (optional)  - many MS spectra (optional)  &lt;p&gt;  Each non-merged spectrum has an index which can be used to access the spectrum.  &lt;p&gt;  In the future we might add some additional information like chromatographic peak or something similar
 */
@JsonPropertyOrder({
  MsData.JSON_PROPERTY_ISOTOPE_PATTERN,
  MsData.JSON_PROPERTY_MERGED_MS1,
  MsData.JSON_PROPERTY_MERGED_MS2,
  MsData.JSON_PROPERTY_MS1_SPECTRA,
  MsData.JSON_PROPERTY_MS2_SPECTRA
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0")
public class MsData {
  public static final String JSON_PROPERTY_ISOTOPE_PATTERN = "isotopePattern";
  @jakarta.annotation.Nullable
  private BasicSpectrum isotopePattern;

  public static final String JSON_PROPERTY_MERGED_MS1 = "mergedMs1";
  @jakarta.annotation.Nullable
  private BasicSpectrum mergedMs1;

  public static final String JSON_PROPERTY_MERGED_MS2 = "mergedMs2";
  @jakarta.annotation.Nullable
  private BasicSpectrum mergedMs2;

  public static final String JSON_PROPERTY_MS1_SPECTRA = "ms1Spectra";
  @jakarta.annotation.Nullable
  private List<BasicSpectrum> ms1Spectra = new ArrayList<>();

  public static final String JSON_PROPERTY_MS2_SPECTRA = "ms2Spectra";
  @jakarta.annotation.Nullable
  private List<BasicSpectrum> ms2Spectra = new ArrayList<>();

  public MsData() {
  }

  public MsData isotopePattern(@jakarta.annotation.Nullable BasicSpectrum isotopePattern) {
    
    this.isotopePattern = isotopePattern;
    return this;
  }

  /**
   * Get isotopePattern
   * @return isotopePattern
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_ISOTOPE_PATTERN)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public BasicSpectrum getIsotopePattern() {
    return isotopePattern;
  }


  @JsonProperty(JSON_PROPERTY_ISOTOPE_PATTERN)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setIsotopePattern(@jakarta.annotation.Nullable BasicSpectrum isotopePattern) {
    this.isotopePattern = isotopePattern;
  }

  public MsData mergedMs1(@jakarta.annotation.Nullable BasicSpectrum mergedMs1) {
    
    this.mergedMs1 = mergedMs1;
    return this;
  }

  /**
   * Get mergedMs1
   * @return mergedMs1
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MERGED_MS1)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public BasicSpectrum getMergedMs1() {
    return mergedMs1;
  }


  @JsonProperty(JSON_PROPERTY_MERGED_MS1)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMergedMs1(@jakarta.annotation.Nullable BasicSpectrum mergedMs1) {
    this.mergedMs1 = mergedMs1;
  }

  public MsData mergedMs2(@jakarta.annotation.Nullable BasicSpectrum mergedMs2) {
    
    this.mergedMs2 = mergedMs2;
    return this;
  }

  /**
   * Get mergedMs2
   * @return mergedMs2
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MERGED_MS2)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public BasicSpectrum getMergedMs2() {
    return mergedMs2;
  }


  @JsonProperty(JSON_PROPERTY_MERGED_MS2)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMergedMs2(@jakarta.annotation.Nullable BasicSpectrum mergedMs2) {
    this.mergedMs2 = mergedMs2;
  }

  public MsData ms1Spectra(@jakarta.annotation.Nullable List<BasicSpectrum> ms1Spectra) {
    
    this.ms1Spectra = ms1Spectra;
    return this;
  }

  public MsData addMs1SpectraItem(BasicSpectrum ms1SpectraItem) {
    if (this.ms1Spectra == null) {
      this.ms1Spectra = new ArrayList<>();
    }
    this.ms1Spectra.add(ms1SpectraItem);
    return this;
  }

  /**
   * Get ms1Spectra
   * @return ms1Spectra
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MS1_SPECTRA)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<BasicSpectrum> getMs1Spectra() {
    return ms1Spectra;
  }


  @JsonProperty(JSON_PROPERTY_MS1_SPECTRA)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMs1Spectra(@jakarta.annotation.Nullable List<BasicSpectrum> ms1Spectra) {
    this.ms1Spectra = ms1Spectra;
  }

  public MsData ms2Spectra(@jakarta.annotation.Nullable List<BasicSpectrum> ms2Spectra) {
    
    this.ms2Spectra = ms2Spectra;
    return this;
  }

  public MsData addMs2SpectraItem(BasicSpectrum ms2SpectraItem) {
    if (this.ms2Spectra == null) {
      this.ms2Spectra = new ArrayList<>();
    }
    this.ms2Spectra.add(ms2SpectraItem);
    return this;
  }

  /**
   * Get ms2Spectra
   * @return ms2Spectra
   */
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MS2_SPECTRA)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<BasicSpectrum> getMs2Spectra() {
    return ms2Spectra;
  }


  @JsonProperty(JSON_PROPERTY_MS2_SPECTRA)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMs2Spectra(@jakarta.annotation.Nullable List<BasicSpectrum> ms2Spectra) {
    this.ms2Spectra = ms2Spectra;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    MsData msData = (MsData) o;
    return Objects.equals(this.isotopePattern, msData.isotopePattern) &&
        Objects.equals(this.mergedMs1, msData.mergedMs1) &&
        Objects.equals(this.mergedMs2, msData.mergedMs2) &&
        Objects.equals(this.ms1Spectra, msData.ms1Spectra) &&
        Objects.equals(this.ms2Spectra, msData.ms2Spectra);
  }

  @Override
  public int hashCode() {
    return Objects.hash(isotopePattern, mergedMs1, mergedMs2, ms1Spectra, ms2Spectra);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class MsData {\n");
    sb.append("    isotopePattern: ").append(toIndentedString(isotopePattern)).append("\n");
    sb.append("    mergedMs1: ").append(toIndentedString(mergedMs1)).append("\n");
    sb.append("    mergedMs2: ").append(toIndentedString(mergedMs2)).append("\n");
    sb.append("    ms1Spectra: ").append(toIndentedString(ms1Spectra)).append("\n");
    sb.append("    ms2Spectra: ").append(toIndentedString(ms2Spectra)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}

